package com.guch.help.adapter;

import android.content.Context;
import android.widget.TextView;

import com.guch.help.R;
import com.guch.help.base.BaseRecyclerViewAdapter;
import com.guch.help.base.RecyclerViewHolder;
import com.guch.help.bean.HistoryRecordBean;

import java.util.List;

public class HistoryRecordAdapter extends BaseRecyclerViewAdapter<HistoryRecordBean> {

    private Context mContext;

    public HistoryRecordAdapter(Context context, List<HistoryRecordBean> data) {
        super(context, data, R.layout.item_history_record);
        mContext = context;
    }

    @Override
    protected void onBindData(RecyclerViewHolder holder, HistoryRecordBean bean, int position) {
        ((TextView) holder.getView(R.id.tv_number)).setText("" + (position + 1));
        ((TextView) holder.getView(R.id.tv_number)).setBackgroundColor(mContext.getResources().getColor(position % 2 == 0 ? R.color.blue_94b1e6 : R.color.blue_ccd4ec));

        ((TextView) holder.getView(R.id.tv_time)).setText(bean.getTime());
        ((TextView) holder.getView(R.id.tv_time)).setBackgroundColor(mContext.getResources().getColor(position % 2 == 0 ? R.color.blue_94b1e6 : R.color.blue_ccd4ec));

        ((TextView) holder.getView(R.id.tv_result)).setText(bean.getResult());
        ((TextView) holder.getView(R.id.tv_result)).setBackgroundColor(mContext.getResources().getColor(position % 2 == 0 ? R.color.blue_94b1e6 : R.color.blue_ccd4ec));

        ((TextView) holder.getView(R.id.tv_remarks)).setText(bean.getRemarks());
        ((TextView) holder.getView(R.id.tv_remarks)).setBackgroundColor(mContext.getResources().getColor(position % 2 == 0 ? R.color.blue_94b1e6 : R.color.blue_ccd4ec));
    }

}